package ru.silviasaint.fridge.server.paginator.impl;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ru.silviasaint.fridge.server.bean.Product;
import ru.silviasaint.fridge.shared.bean.ProductSkinny;
import ru.silviasaint.fridge.shared.paginator.PaginatorAction;
import ru.silviasaint.fridge.shared.paginator.PaginatorResult;

import com.gwtplatform.dispatch.server.ExecutionContext;
import com.gwtplatform.dispatch.server.actionhandler.ActionHandler;
import com.gwtplatform.dispatch.shared.ActionException;

public class ProductActionHandler implements ActionHandler<PaginatorAction, PaginatorResult>{
	private Logger logger = LoggerFactory.getLogger(ProductActionHandler.class);
	@Override
	public PaginatorResult execute(PaginatorAction action,
			ExecutionContext paramExecutionContext) throws ActionException {
		logger.debug("execute product paginator action");
		PaginatorResult result = new PaginatorResult();
		List<ProductSkinny> products = new ArrayList<ProductSkinny>();

		products.add(new ProductSkinny("ЯБЛОКО", 1L));
		products.add(new ProductSkinny("ГРУША", 2L));
		products.add(new ProductSkinny("ХУЙ", 3L));
		result.setResult(products);
		return result;
	}

	@Override
	public Class<PaginatorAction> getActionType() {
		return null;
	}

	@Override
	public void undo(PaginatorAction action, PaginatorResult result,
			ExecutionContext paramExecutionContext) throws ActionException {

	}

}
